package com.example.classassistant;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;

import java.util.ArrayList;
import java.util.List;

public class Group {
    String groupName;
    ObservableList<Student> students;
    int score;

    public Group(String groupName) {
        this.groupName = groupName;
        this.students = FXCollections.observableArrayList();
        this.score = 0;
    }


    public void addStudent(Student student) {
        students.add(student);
    }

    public void removeStudent(Student student) {
        students.remove(student);
    }

    public ObservableList<Student> getStudents() {
        return students;
    }

    @Override
    public String toString() {
        return "Group: " + groupName +
                " 小组成绩: " + score + '\n' +
                students;
    }

    public void setScore(int score){
        this.score = score;
    }
    public int getScore(){
        return score;
    }
}

